package Tools;
use strict;
use Encode qw/encode decode/;
use Exporter;
use vars qw/ $VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS /;

$VERSION        = 1.00;
@ISA            = qw/Exporter/;
@EXPORT         = qw/ sayinf sayerr /;
@EXPORT_OK      = qw/ sayinf sayerr /;
%EXPORT_TAGS    = (DEFAULT  => [qw(&sayinf)],
                   Both     => [qw(&sayinf &sayerr)]);

sub compatprint{
    my($content) = @_;
    if ( $^O =~ /MSWin32/ ) {
        print encode('gbk',decode('utf-8',$content));
    } else {
        print $content;
    }
}

sub sayinf{
    my($content) = @_;
    print "[inf] ";
    &compatprint($content);
    print "\n";
}

sub sayerr{
    my($content) = @_;
    print "[!error] ";
    &compatprint($content);
    print "\n";
}


1;
